barometer2 2.2.0
barometer2


Barometer 2 Click

Barometer 2 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : MikroE Team
  • Date : Nov 2019.
  • Type : I2C type

Software Support

Example Description

The example starts off with the initialization and configuration of the Click and logger modules, tests the communication channel and reads and displays temperature and pressure values every second.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Barometer2

Example Key Functions

Application Init

Initializes and configures the Click and logger modules and tests the communication for errors.

{
log_cfg_t log_cfg;
uint8_t test;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
BAROMETER2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
barometer2_init( &barometer2, &cfg );
barometer2_default_cfg( &barometer2 );
// Test communication
if ( test == BAROMETER2_WHO_AM_I )
{
log_printf( &logger, "---- Communication OK!!! ----\r\n" );
}
else
{
log_printf( &logger, "---- Communication ERROR!!! ----\r\n" );
for ( ; ; );
}
// Software reset
barometer2_software_reset( &barometer2 );
Delay_1sec();
Delay_1sec( );
log_printf( &logger, "---- Start Measurement ---- \r\n" );
}
#define BAROMETER2_MAP_MIKROBUS(cfg, mikrobus)
Definition barometer2.h:66
uint8_t barometer2_read_byte(barometer2_t *ctx, uint8_t reg)
Read one byte function.
#define BAROMETER2_REG_WHO_AM_I
Definition barometer2.h:89
#define BAROMETER2_WHO_AM_I
Definition barometer2.h:212
void application_init()
Definition main.c:32

Application Task

Reads and displays temperature and pressure values every second.

{
float temperature;
float pressure;
log_printf( &logger, " Temperature : %f ", temperature );
log_printf( &logger, " Pressure : %f \n", pressure );
log_printf( &logger, "--------------------------\n" );
Delay_ms ( 1000 );
}
#define BAROMETER2_PRESSURE_DATA_IN_mBar
Definition barometer2.h:221
#define BAROMETER2_TEMPERATURE_IN_CELSIUS
Definition barometer2.h:233
void application_task()
Definition main.c:82

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.